package toolkit;

public class Debug
{
	private static boolean enabled = true;
	
	private static boolean textual = false;
	
	public static void setEnabled(boolean enabled)
	{
		Debug.enabled = enabled;
	}
	
	public static boolean isEnabled()
	{
		return enabled;
	}

	public static void setTextual(boolean textual)
	{
		Debug.textual = textual;
	}
	
	public static boolean isTextual()
	{
		return textual;
	}
	
	public static String toString(Object o)
	{
		//return ReflectionToStringBuilder.toString(o, ToStringStyle.MULTI_LINE_STYLE, true);
		return null;
	}
	
	public static void log(Object o)
	{
		log(o, null);
	}
	
	public static void log(Object o, String label)
	{
		// TODO: also errors only need to be shown when enabled.
		if (o instanceof Exception)
		{
			Exception e = (Exception) o;
			
			e.printStackTrace();
		}
		else
		{
			if (enabled)
			{
				System.out.println(label != null ? label + ": " + o : o);
			}
		}
	}

	public static void printLine()
	{
		if (enabled)
		{
			System.out.println();
		}
	}
	
	public static void printSolidLine()
	{
		if (enabled)
		{
			System.out.println("\n===============\n");
		}
	}
}
